package com.charlotte.study.gupao.iterator.course;

import java.util.ArrayList;
import java.util.List;

/**
 * @author junjie.ding
 * @date 2020/3/16
 */
public class Test {

    public static void main(String[] args) {

        Course javaCourse = new Course("java课程");

        Course pythonCourse = new Course("python课程");

        List<Course> list = new ArrayList<>();
        list.add(javaCourse);
        list.add(pythonCourse);

        CourseAggregate aggregate = new CourseAggregateImpl(list);
        Iterator<Course> iterator = aggregate.iterator();
        while(iterator.hasNext()){
            System.out.println(iterator.next().getName());
        }
    }
}
